﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace LibSnesDotNet.UI
{
	public class UISection : ObservableConfigurationSection
	{
		public UISection()
		{
			SectionInformation.AllowExeDefinition = ConfigurationAllowExeDefinition.MachineToRoamingUser;
		}

		[ConfigurationProperty("window", IsRequired = true)]
		public WindowElement Window { get { return (WindowElement)this["window"]; } set { this["window"] = value; } }
		[ConfigurationProperty("theme", IsRequired = true)]
		public ThemeElement Theme { get { return (ThemeElement)this["theme"]; } set { this["theme"] = value; } }
	}

	public class WindowElement : ObservableConfigurationElement
	{
		[ConfigurationProperty("x", IsRequired = false)]
		public int? X { get { return (int?)this["x"]; } set { this["x"] = value; } }
		[ConfigurationProperty("y", IsRequired = false)]
		public int? Y { get { return (int?)this["y"]; } set { this["y"] = value; } }

		[ConfigurationProperty("width", IsRequired = true, DefaultValue = 597)]
		[IntegerValidator(MinValue = 597)]
		public int Width { get { return (int)this["width"]; } set { this["width"] = value; } }
		[ConfigurationProperty("height", IsRequired = true, DefaultValue = 448)]
		[IntegerValidator(MinValue = 448)]
		public int Height { get { return (int)this["height"]; } set { this["height"] = value; } }
	}

	public class ThemeElement : ObservableConfigurationElement
	{
		[ConfigurationProperty("source", IsRequired = true, DefaultValue = UIWindow.DefaultTheme)]
		public string Source { get { return (string)this["source"]; } set { this["source"] = value; } }
	}
}
